package com.lhkj.ct.meta.modules.psychology.model.vo;

import cn.hutool.core.img.ImgUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.lhkj.ct.meta.modules.gauge.common.enums.ChartType;
import com.lhkj.ct.meta.modules.gauge.common.enums.ReportLayout;
import com.lhkj.ct.meta.modules.psychology.model.entity.TblGaugeAnswer;
import com.lhkj.ct.meta.modules.psychology.model.entity.TblScaleReportContent;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 *     个体报告信息
 * </p>
 */
@Setter
@Getter
public class PersonalReportInfo implements Serializable {

    @ApiModelProperty(value = "报告id")
    private String id;

    @ApiModelProperty(value = "量表名称")
    private String scaleName;

    @ApiModelProperty(value = "报告排版")
    private ReportLayout layout;

    @ApiModelProperty(value = "统计图表类型")
    private ChartType chart;

    @ApiModelProperty(value = "报告状态 0.待审核 1.已审核 2.已发布")
    private Integer reportStatus;

    @ApiModelProperty("基本信息")
    private BasicInfo basicInfo;

    @ApiModelProperty("维度报告")
    private List<TblScaleReportContent> dimReport;

    @ApiModelProperty("原始答卷")
    private List<TblGaugeAnswer> answers;

    @Setter
    @Getter
    public static class BasicInfo{

        @ApiModelProperty(value = "测验简介")
        private String introduction;

        @ApiModelProperty(value = "姓名")
        private String patName;

        @ApiModelProperty(value = "性别")
        private String patSex;

        @ApiModelProperty(value = "年龄")
        private String patAge;

        @ApiModelProperty(value = "出生日期")
        private String patBirthday;

        @ApiModelProperty(value = "手机号码")
        private String patMobile;

        @ApiModelProperty(value = "测评时间(提交时间)")
        private String submissionTime;

        @ApiModelProperty(value = "审核人")
        private String reviewBy;

        @ApiModelProperty(value = "审核人电子签名", hidden = true)
        @JsonIgnore
        private byte[] signature;

        @ApiModelProperty(value = "审核时间")
        private String reviewTime;

    }

    public String getChartBase64() {
        return ImgUtil.toBase64DataUri(getChart().getBuildChart().apply(this), "jpg");
    }

}
